Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Exit #107

Merged
merged 4 commits into from
Oct 19, 2023
Merged

Nested Exit #107

merged 4 commits into from
Oct 19, 2023

Conversation

brunoguerios
Copy link
Member

@brunoguerios brunoguerios commented Oct 17, 2023

  • Add proportional nested exit
  • Add single token nested exit

@brunoguerios brunoguerios self-assigned this Oct 17, 2023
Comment on lines +66 to +74
// TODO: previous implementation of nested exit didn't add an outputReferenceKey for the BPT token,
// but if I remove it from here, peek logic fails. Need to investigate why.
// Once we figure this out, we should be able to replace sortedTokens by sortedTokensWithoutBpt
outputReferenceKeys: sortedTokens.map(
(token) =>
100n +
BigInt(poolsSortedByLevel.indexOf(pool)) * 10n +
BigInt(sortedTokens.indexOf(token)),
),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johngrantuk - I'd like to highlight this part of the code here - at the end I think we'll need input from the SC team, but I'd like to run by someone internally first, to make sure there's nothing obvious that I'm missing regarding indexes, etc..
Basically it seems that relayerQueries ignores the outputReference index I set and query fails if I remove the outputReference related to the BPT token, because it reads the incorrect amount.
On the other hand, having an outputReference related to the BPT token breaks the transaction itself.
To fix this, I first add it to the query and later remove when building the transaction.
It works, but I'd expect this kind of manipulation to not be necessary between query vs actual transaction.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to replicate the same behavior for single token nested exit, so I decided to reach out to the SC team to check this out.

@brunoguerios brunoguerios merged commit f437da1 into nested-join Oct 19, 2023
3 of 4 checks passed
@brunoguerios brunoguerios deleted the nested-exit branch October 19, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant